package com.planet.stockanalysis.server.serviceimpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.planet.stockanalysis.server.dao.StockCodeDao;
import com.planet.stockanalysis.server.dao.StockDao;
import com.planet.stockanalysis.server.entity.Stock;
import com.planet.stockanalysis.server.entity.StockCode;
import com.planet.stockanalysis.server.service.StockService;

@Service("stockService")
public class StockServiceImpl implements StockService{
	@Autowired
	private StockDao stockDao; 
	@Autowired
	private StockCodeDao stockCodeDao;
	public Stock addStock(Stock stock){
		return stockDao.save(stock);
	}
	@Override
	public void deleteAll() {
		stockDao.deleteAll();
	}
	@Override
	public List<Stock> getAll() {
		// TODO Auto-generated method stub
		return (List<Stock>) stockDao.findAll();
	}
	@Override
	public StockCode findStockCode(String code) {
		// TODO Auto-generated method stub
		return stockCodeDao.findByCode(code);
	}
}